home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume16 / conf2 / part01 next >
Encoding:
Internet Message Format  |  1988-09-14  |  15.9 KB

  1. Subject:  v16i001:  Multi-user conference system, Part01/04
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rsalz@uunet.UU.NET
  5.  
  6. Submitted-by: Keith Gabryelski <ucsd!elgar!ag>
  7. Posting-number: Volume 16, Issue 1
  8. Archive-name: conf2/part01
  9.  
  10. Conf is a line oriented multi-user chat program designed to work on any
  11. SysV, BSD, or Xenix system.
  12.  
  13. Conf has several advantages over the standard write program supplied
  14. with most Unix and Xenix operating systems.
  15.     + Unlimited users conferencing at once.
  16.     + 100 separate discussion lines.
  17.     + Public and private messages in addition to password
  18.       encrypted messages.
  19.     + Quick and efficient user interaction.
  20.     + User definable formats for messages.
  21.     + Intelligent message display algorithm.
  22.  
  23.  
  24. #! /bin/sh
  25. # This is a shell archive, meaning:
  26. # 1. Remove everything above the #! /bin/sh line.
  27. # 2. Save the resulting text in a file.
  28. # 3. Execute the file with /bin/sh (not csh) to create the files:
  29. #    MANIFEST
  30. #    Makefile
  31. #    conf.c
  32. #    conf.el
  33. export PATH; PATH=/bin:$PATH
  34. if test -f 'MANIFEST'
  35. then
  36.     echo shar: will not over-write existing file "'MANIFEST'"
  37. else
  38. cat << \SHAR_EOF > 'MANIFEST'
  39. A Manifest           Archived in
  40. ------------------------------------------------------------------------
  41. MANIFEST            1
  42. Makefile            1
  43. conf.c                1
  44. conf.el                1
  45. conf.h                2
  46. confalloc.c            2
  47. config.h            2
  48. confopts.c            2
  49. confprnt.c            3
  50. confrots.c            3
  51. confrw.c            3
  52. confsig.c            4
  53. confstr.c            4
  54. extern.h            4
  55. structs.h            4
  56. doc/READ_ME            5
  57. doc/conf.1            5
  58. doc/conf.txt            5
  59. doc/confhelp            5
  60. SHAR_EOF
  61. fi # end of overwriting check
  62. if test -f 'Makefile'
  63. then
  64.     echo shar: will not over-write existing file "'Makefile'"
  65. else
  66. cat << \SHAR_EOF > 'Makefile'
  67. SHELL=/bin/sh
  68. INSTALL= mv
  69. CFLAGS= -g
  70. SRCS= conf.c confrw.c confrots.c confopts.c confalloc.c confstr.c confprnt.c confsig.c
  71. OBJS= conf.o confrw.o confrots.o confopts.o confalloc.o confstr.o confprnt.o confsig.o
  72. HEADERS= conf.h config.h extern.h structs.h
  73. NEW= xconf
  74. NAME= conf
  75. LISP= conf.el
  76. MAKES= Makefile
  77. DOCDIR= doc
  78. CONFLIB= /usr/lib/conf
  79. CONFSPOOL= /usr/spool/conf
  80. BINDIR= /usr/local/bin
  81. LINT=lint
  82. OWNER=conf
  83. GROUP=conf
  84.  
  85. LIBS= -ltermlib
  86.  
  87. $(NEW): $(OBJS)
  88.     $(CC) $(CFLAGS) -o $(NEW) $(OBJS) $(LIBS)
  89.  
  90. all: $(NEW) install
  91.  
  92. clean:
  93.     rm -f *.o $(NEW) core
  94.  
  95. shar:
  96.     shar MANIFEST Makefile conf.c conf.el > confshar.1
  97.     shar conf.h confalloc.c config.h confopts.c > confshar.2
  98.     shar confprnt.c confrots.c confrw.c > confshar.3
  99.     shar confsig.c confstr.c extern.h structs.h > confshar.4
  100.     shar doc > confshar.5
  101.  
  102. lint:
  103.     $(LINT) $(LIBS) $(SRCS)
  104.  
  105. install:
  106.     cp $(NEW) $(BINDIR)/$(NAME)
  107.  
  108.     -mkdir $(CONFLIB)
  109.  
  110.     cp $(DOCDIR)/confhelp $(CONFLIB)
  111.     -chgrp $(GROUP) $(CONFLIB) $(CONFLIB)/confhelp $(BINDIR)/$(NAME)
  112.     -chown $(OWNER) $(CONFLIB) $(CONFLIB)/confhelp $(BINDIR)/$(NAME)
  113.     -chmod u+s $(BINDIR)/$(NAME)
  114.     -chmod 644 $(CONFLIB)/confhelp
  115.     -chmod 755 $(CONFLIB)
  116. SHAR_EOF
  117. fi # end of overwriting check
  118. if test -f 'conf.c'
  119. then
  120.     echo shar: will not over-write existing file "'conf.c'"
  121. else
  122. cat << \SHAR_EOF > 'conf.c'
  123. #include "conf.h"
  124.         /* Talk, talk ... it's all talk! */
  125.  
  126. char *progname;                    /* program name (argv[0]) */
  127. char *logname, *homedir;
  128.  
  129. int lfd, log_rfd, log_wfd, usr_fd;
  130. long ourplace;
  131. FILE *rec_fp;
  132. int confing = FALSE;
  133.  
  134. char replyname[MAXNAMELEN] = "";
  135. char replytty[MAXTTYLEN+1] = "";    /* there is a reason for the + 1
  136.                         although I have forgotten it
  137.                         right now, I'm sure it should
  138.                         be there.
  139.                      */
  140.  
  141. char *wrdata;
  142. unsigned wdlen=0;
  143.  
  144. struct cusrfil cuser, tuser;
  145. struct clogfil clog, tlog;
  146.  
  147. #ifdef    SYSV
  148. struct termio term, saveterm;
  149. #endif    SYSV
  150.  
  151. #ifdef    BSD
  152. struct tchars chrstr;
  153. struct sgttyb ktty;
  154. int ttyflags;
  155. #endif    BSD
  156.  
  157. char ichar = CTRL('C');                /* interrupt character */
  158. char qchar = CTRL('\\');            /* quit character */
  159.  
  160. jmp_buf env;
  161.  
  162. int columns = 80, lines = 24, banner = TRUE, seeme = TRUE, informe = FALSE,
  163.     lineinput = FALSE, beep = FALSE, expand8bit = TRUE, expandctrl = TRUE;
  164.  
  165. char *cls = NULL, *pager, *shell, *normform, *lineform, *shoutform, *sendform,
  166.     *informform, *recfile;
  167.  
  168. my_int()
  169. {
  170.     longjmp(env, 1);
  171. }
  172.  
  173. #ifdef BSD
  174. stopit()
  175. {
  176.     ktty.sg_flags = ttyflags;
  177.     stty(0, &ktty);
  178.     (void) signal(SIGTSTP, SIG_DFL);
  179.     (void) kill(0, SIGTSTP);
  180.     gtty(0, &ktty);
  181.     ttyflags = ktty.sg_flags;
  182.  
  183.     if (!(ttyflags&ECHO))
  184.     lineinput = TRUE;
  185.  
  186.     ktty.sg_flags |= CBREAK;
  187.     ktty.sg_flags &= ~ECHO;
  188.     stty(0, &ktty);
  189.  
  190.     (void) ioctl(0, TIOCGETC, &chrstr);
  191.     
  192.     ichar = chrstr.t_intrc;
  193.     qchar = chrstr.t_quitc;
  194.     (void) signal(SIGTSTP, stopit);
  195. }
  196. #endif BSD
  197.  
  198. main(argc, argv)
  199. int argc;
  200. char *argv[];
  201. {
  202.     char *ptr, *word, *line, answer;
  203.     int num, x, c, old_umask, rotten_egg;
  204.     struct passwd *pt;
  205.  
  206.     progname = *argv++; --argc; 
  207.  
  208.     /* Open all support files */
  209.  
  210.     old_umask = umask(0);
  211.  
  212.     x = 0;
  213.     while ((lfd = open(CONFLOCK, O_CREAT|O_EXCL, 0666)) < 0)
  214.     {
  215.     if (++x > 60)        /* looks like the lock file may be hosed */
  216.     {
  217.         printf("The lock file %s looks like it is wedged.\n", CONFLOCK);
  218.         printf("What should I do; (A)bort, (C)ontinue, or (R)emove? ");
  219.  
  220.         answer = 'a';
  221.  
  222.         while (((c = getchar()) != '\n') && (c != CR))
  223.         {
  224.         switch(c)
  225.         {
  226.         case 'a':
  227.         case 'A':
  228.         case 'C':
  229.         case 'c':
  230.         case 'R':
  231.         case 'r':
  232.             answer = c;
  233.             break;
  234.  
  235.         default:
  236.             printf("\n(A)bort, (C)ontinue, or (R)emove? ");
  237.             break;
  238.         }
  239.         }
  240.         
  241.         switch(answer)
  242.         {
  243.         case 'a':
  244.         case 'A':
  245.         (void) umask(old_umask);
  246.         exit(-1);
  247.  
  248.         case 'c':
  249.         case 'C':
  250.         x = 0;
  251.         continue;
  252.  
  253.         case 'r':
  254.         case 'R':
  255.         (void) unlink(CONFLOCK);
  256.         continue;
  257.         }
  258.  
  259.         sleep(1);
  260.     }
  261.     }
  262.  
  263.     close(lfd);
  264.  
  265.     if ((usr_fd = open(CONFUSERS, O_RDWR|O_CREAT, FILEMASK)) < 0)
  266.     {
  267.     (void) fprintf(stderr, "%s: couldn't open %s (%s)\n", progname,
  268.                CONFUSERS, puterr(errno));
  269.     (void) exit(-1);
  270.     }
  271.  
  272.     (void) lseek(usr_fd, 0L, 0);
  273.  
  274.     if ((argc == 1) && (!strcmp(*argv, "-T")))
  275.     {
  276.     (void) lseek(usr_fd, 0L, 0);
  277.  
  278. #ifdef    SYSV
  279.     lockf(usr_fd, F_LOCK, 0L);    /* lock user file */
  280. #endif    SYSV
  281.  
  282. #ifdef    BSD
  283.     flock(usr_fd, LOCK_EX);
  284. #endif    BSD
  285.  
  286.     rotten_egg = TRUE;
  287.     while (read(usr_fd, (char *)&tuser, sizeof(struct cusrfil)) ==
  288.            sizeof(struct cusrfil))
  289.         if (tuser.cu_flags != USER_OFF)
  290.         {
  291.         c = kill(tuser.cu_procid, 0);
  292.         if ((!c) || ((c < 0) && (errno != ESRCH)))
  293.             rotten_egg = FALSE;
  294.         }
  295.  
  296. #ifdef    SYSV
  297.     (void) lseek(usr_fd, 0L, 0);
  298.     lockf(usr_fd, F_ULOCK, 0L);
  299. #endif    SYSV
  300.  
  301. #ifdef    BSD
  302.     flock(usr_fd, LOCK_UN);
  303. #endif    BSD
  304.  
  305.     if (rotten_egg)
  306.     {
  307.         close(usr_fd);
  308.         open(CONFLOG, O_TRUNC);
  309.         open(CONFUSERS, O_TRUNC);
  310.     }
  311.  
  312.     unlink(CONFLOCK);
  313.     exit(0);
  314.     }
  315.  
  316.     if ((log_wfd = open(CONFLOG, O_WRONLY|O_CREAT|O_APPEND, FILEMASK)) < 0)
  317.     {
  318.     (void) fprintf(stderr,"%s: couldn't create/open %s for writing(%s)\n",
  319.                progname, CONFLOG, puterr(errno));
  320.     (void) exit(-1);
  321.     }
  322.  
  323.     (void) umask(old_umask);
  324.  
  325.     if ((log_rfd = open(CONFLOG, O_RDONLY)) < 0)
  326.     {
  327.     (void) fprintf(stderr,"%s: couldn't open %s for reading (%s)\n",
  328.                progname, CONFLOG, puterr(errno));
  329.     (void) exit(-1);
  330.     }
  331.  
  332.     unlink(CONFLOCK);
  333.  
  334.     setuid(getuid());
  335.  
  336.     (void) lseek(log_rfd, 0L, 2);
  337.  
  338.     /* set up some pointers to interesting stuff */
  339.  
  340.     wrdata = mymalloc(wdlen = PAGESIZ);
  341.  
  342.     cuser.cu_line = 1;
  343.     cuser.cu_flags = USER_ON;
  344.     cuser.cu_procid = getpid();
  345.  
  346.     pt = getpwuid(getuid());
  347.  
  348.     if ((ptr = getlogin()) == NULL)
  349.     if ((ptr = pt->pw_name) == NULL)
  350.         ptr = "somebody";        /* can't figure this guy out */
  351.  
  352.     logname = mymalloc((unsigned)(strlen(ptr)+1));
  353.     (void) strcpy(logname, ptr);
  354.  
  355.     (void) strcpy(cuser.cu_cname, ptr);
  356.  
  357.     if ((ptr = ttyname(0)) == NULL)
  358.     strcpy(cuser.cu_tty, "tty??");
  359.     else
  360.     strcpy(cuser.cu_tty, ((ptr= strrchr(ptr, '/')) ? ptr+1 : "tty??"));
  361.  
  362.     homedir = mymalloc((unsigned)(strlen(pt->pw_dir)+1));
  363.     (void) strcpy(homedir, pt->pw_dir);
  364.  
  365.     cls = mymalloc((unsigned)1);
  366.     *cls = '\0';
  367.  
  368.     normform = mymalloc((unsigned)(sizeof(DEF_FORM_NORM)));
  369.     (void) strcpy(normform, DEF_FORM_NORM);
  370.  
  371.     sendform = mymalloc((unsigned)(sizeof(DEF_FORM_SEND)));
  372.     (void) strcpy(sendform, DEF_FORM_SEND);
  373.  
  374.     shoutform = mymalloc((unsigned)(sizeof(DEF_FORM_SHOUT)));
  375.     (void) strcpy(shoutform, DEF_FORM_SHOUT);
  376.  
  377.     informform = mymalloc((unsigned)(sizeof(DEF_FORM_INFORM)));
  378.     (void) strcpy(informform, DEF_FORM_INFORM);
  379.  
  380.     lineform = mymalloc((unsigned)(sizeof(DEF_FORM_LINE)));
  381.     (void) strcpy(lineform, DEF_FORM_LINE);
  382.  
  383.     pager = mymalloc((unsigned)(sizeof(DEF_PAGER)));
  384.     (void) strcpy(pager, DEF_PAGER);
  385.  
  386.     shell = mymalloc((unsigned)(sizeof(DEF_SHELL)));
  387.     (void) strcpy(shell, DEF_SHELL);
  388.  
  389.     recfile = mymalloc((unsigned)(sizeof(DEF_RECFILE)));
  390.     (void) strcpy(recfile, DEF_RECFILE);
  391.  
  392.     gettcap();            /* get termcap stuff */
  393.     getrc();            /* get some defaults from rc file */
  394.     getopts();            /* get some defaults from environment */
  395.  
  396.     while (word = *argv++, argc--)
  397.     {
  398.     if (*word == '-')
  399.     {
  400.        word++;
  401.  
  402.        while (*word != '\0')
  403.        {
  404.            switch(*word++)
  405.            {
  406.            case 'T':
  407.            printf("%s: -T wasn't specified by itself.  Ignoring...\n",
  408.               progname);
  409.  
  410.            case 'l':
  411.            if (*word == '\0')
  412.            {
  413.                if (!argc)
  414.                {
  415.                (void) printf("%s: -l switch specified without a conference line number\n",
  416.                      progname);
  417.                usage();
  418.                }
  419.                word = *argv++; --argc;
  420.            }
  421.  
  422.            num = atoi(word);
  423.            if ((num < 1) || (num > MAXCONFLINES))
  424.            {
  425.               (void) printf("%s: invalid conference line number: %d\n",
  426.                     progname, num);
  427.               usage();
  428.           }
  429.            cuser.cu_line = num;
  430.            *word = '\0';
  431.            break;
  432.  
  433.            case 's':
  434.            if (*word == '\0')
  435.            {
  436.                if (!argc)
  437.                {
  438.                (void) fprintf(stderr,
  439.                       "%s: -s specified without a parameter\n",
  440.                       progname);
  441.                usage();
  442.                }
  443.                word = *argv++; --argc;
  444.            }
  445.  
  446.            if ((x = setopts(parsestr(word, strlen(word), NEXTWORD)))
  447.                != FOUNDOPT)
  448.            {
  449.                char *errmess;
  450.  
  451.                if (x == AMBIGUOUS)
  452.                errmess = "Ambiguous";
  453.                else
  454.                errmess = "Invalid";
  455.                 
  456.                (void) fprintf(stderr, "%s: %s -s parameter: %s\n",
  457.                       progname, errmess, word);
  458.                usage();
  459.            }
  460.            *word = '\0';
  461.            break;
  462.  
  463.            case 'w':
  464.            (void) do_who(0);
  465.            (void) exit(0);
  466.  
  467.            default:
  468.            (void)fprintf(stderr, "%s: invalid parameter '%c'\n",
  469.                  progname, *(word-1));
  470.            usage();
  471.            }
  472.        }
  473.        }
  474.     else
  475.         (void) do_ring(word);
  476.     }
  477.  
  478.     /* by this point, all parameters/options have been parsed */
  479.  
  480.     confing = TRUE;
  481.  
  482.     clog.f_line = cuser.cu_line;
  483.     clog.f_usrlen = strlen(cuser.cu_cname) + 1;
  484.     clog.f_ttylen = strlen(cuser.cu_tty) + 1;
  485.  
  486.     (void) lseek(usr_fd, 0L, 0);
  487.  
  488. #ifdef    SYSV
  489.     lockf(usr_fd, F_LOCK, 0L);    /* lock user file */
  490. #endif    SYSV
  491.  
  492. #ifdef    BSD
  493.     flock(usr_fd, LOCK_EX);
  494. #endif    BSD
  495.  
  496.     ourplace = lseek(usr_fd, 0L, 1);
  497.     while (read(usr_fd, (char *)&tuser, sizeof(struct cusrfil)) ==
  498.     sizeof(struct cusrfil))
  499.     if (tuser.cu_flags == USER_OFF)
  500.         break;
  501.     else
  502.         ourplace = lseek(usr_fd, 0L, 1);
  503.  
  504.     (void) lseek(usr_fd, ourplace, 0);
  505.  
  506.     write(usr_fd, (char *)&cuser, sizeof(struct cusrfil));
  507.  
  508. #ifdef    SYSV
  509.     (void) lseek(usr_fd, 0L, 0);
  510.     lockf(usr_fd, F_ULOCK, 0L);
  511. #endif    SYSV
  512.  
  513. #ifdef    BSD
  514.     flock(usr_fd, LOCK_UN);
  515. #endif    BSD
  516.  
  517.     /* any fatal errors pass this point must do a nice_exit(status) */
  518.  
  519.     write_log(INFORM, "Login", (char *)NULL, 0, (unsigned)strlen("Login"));
  520.  
  521. #ifdef    SYSV
  522.     (void) ioctl(0, TCGETA, &term);
  523.     saveterm=term;
  524.  
  525.     if (!(term.c_lflag&ECHO))
  526.     lineinput = TRUE;
  527.  
  528.     ichar = term.c_cc[VINTR];
  529.     qchar = term.c_cc[VQUIT];
  530.  
  531.     term.c_iflag &= ~(ICRNL);
  532.     term.c_lflag &= ~(ICANON|ECHO);
  533.     term.c_cc[VEOF] = 1;
  534.     term.c_cc[VEOL] = 0;
  535.     (void) ioctl(0, TCSETAW, &term);
  536.     
  537. #endif    SYSV
  538.  
  539. #ifdef    BSD
  540.     gtty(0, &ktty);
  541.     ttyflags = ktty.sg_flags;
  542.  
  543.     if (!(ttyflags&ECHO))
  544.     lineinput = TRUE;
  545.  
  546.     ktty.sg_flags |= CBREAK;
  547.     ktty.sg_flags &= ~ECHO;
  548.     stty(0, &ktty);
  549.  
  550.     (void) ioctl(0, TIOCGETC, &chrstr);
  551.     
  552.     ichar = chrstr.t_intrc;
  553.     qchar = chrstr.t_quitc;
  554. #endif    BSD
  555.  
  556.     (void) signal(SIGINT, SIG_IGN);
  557.     (void) signal(SIGQUIT, fatal);
  558.     (void) signal(SIGHUP, nice_exit);
  559.     (void) signal(SIGTERM, nice_exit);
  560.     (void) signal(SIGILL, fatal);
  561.     (void) signal(SIGTRAP, fatal);
  562.     (void) signal(SIGIOT, fatal);
  563.     (void) signal(SIGEMT, fatal);
  564.     (void) signal(SIGFPE, fatal);
  565.     (void) signal(SIGBUS, fatal);
  566.     (void) signal(SIGSEGV, fatal);
  567.     (void) signal(SIGSYS, fatal);
  568.     (void) signal(SIGPIPE, fatal);
  569.  
  570. #ifdef SIGTSTP
  571.     (void) signal(SIGTSTP, stopit);
  572. #endif SIGTSTP
  573.  
  574.     if (banner)
  575.     (void) version(FALSE);
  576.  
  577.     (void) printf("login user %s (%s) on conference line %d\n",
  578.           cuser.cu_cname, cuser.cu_tty, cuser.cu_line);
  579.  
  580.     if (setjmp(env))
  581.     {
  582.     (void) signal(SIGINT, my_int);
  583.     dispchar(ichar, stdout, NOVIS);
  584.     (void) putchar('\n');
  585.     (void) lseek(log_rfd, 0L, 2);
  586.     }
  587.     else
  588.     (void) signal(SIGINT, my_int);
  589.  
  590.     forever
  591.     {
  592.     read_log();
  593.  
  594.     fflush(stdout);        /* damnit */
  595.     line = getline();
  596.     (void) signal(SIGINT, my_int);
  597.     if (line != NULL)
  598.     {
  599.         if ((*line == ':') && (*(line+1) != ':'))
  600.         {
  601.             if (*(line+1) == '!')
  602.             keep_shell(line+2);
  603.         else
  604.         {
  605.             --linelen;
  606.             (void) intpret(line+1);
  607.         }
  608.         }
  609.         else
  610.         {
  611.         if (*line == ':')
  612.             write_log(NORMAL, line+1, (char *)NULL, 0, linelen-1);
  613.         else
  614.             write_log(NORMAL, line, (char *)NULL, 0, linelen);
  615.         }
  616.         free(line);
  617.     }
  618.     }
  619. }
  620.  
  621. nice_exit(status)
  622. int status;
  623. {
  624.     make_nice(TRUE);
  625.  
  626.     (void) signal(SIGALRM, SIG_DFL);
  627.     (void) signal(SIGINT, SIG_DFL);
  628.     (void) signal(SIGQUIT, SIG_DFL);
  629.     (void) signal(SIGHUP, SIG_DFL);
  630.     (void) signal(SIGTERM, SIG_DFL);
  631.     (void) signal(SIGILL, SIG_DFL);
  632.     (void) signal(SIGTRAP, SIG_DFL);
  633.     (void) signal(SIGIOT, SIG_DFL);
  634.     (void) signal(SIGEMT, SIG_DFL);
  635.     (void) signal(SIGFPE, SIG_DFL);
  636.     (void) signal(SIGBUS, SIG_DFL);
  637.     (void) signal(SIGSEGV, SIG_DFL);
  638.     (void) signal(SIGSYS, SIG_DFL);
  639.     (void) signal(SIGPIPE, SIG_DFL);
  640.  
  641.     (void) exit(status);
  642. }
  643.  
  644. make_nice(status)
  645. int status;
  646. {
  647.     (void) alarm(0);
  648.  
  649.     if (status)
  650.     write_log(INFORM,"Logout",(char *)NULL,0, (unsigned)strlen("Logout"));
  651.  
  652.     if (cuser.cu_flags&USER_RECORD)
  653.     (void)fclose(rec_fp);
  654.  
  655.     cuser.cu_flags = USER_OFF;
  656.     write_usr();
  657.  
  658.     (void) close(usr_fd);
  659.     (void) close(log_rfd);
  660.     (void) close(log_wfd);
  661.  
  662. #ifdef    SYSV
  663.     (void) ioctl(0, TCSETAW, &saveterm);
  664. #endif    SYSV
  665.  
  666. #ifdef    BSD
  667.     ktty.sg_flags = ttyflags;
  668.     stty(0, &ktty);
  669. #endif    BSD
  670.  
  671.     execlp(progname, progname, "-T", (char *)0);
  672. }
  673.  
  674. usage()
  675. {
  676.     (void) fprintf(stderr,
  677.            "usage: %s [-T][-w][-s switchname][-l line-number]\n",
  678.            progname);
  679.     (void) exit(-1);
  680. }
  681. SHAR_EOF
  682. fi # end of overwriting check
  683. if test -f 'conf.el'
  684. then
  685.     echo shar: will not over-write existing file "'conf.el'"
  686. else
  687. cat << \SHAR_EOF > 'conf.el'
  688. ;; Run conf(1) as asynchronous inferior of Emacs.
  689. ;; provided by Michael Ditto (ford@kenobi.cts.com)
  690. ;; This file is not part of GNU Emacs.
  691.  
  692. (defvar conf-process nil "The process of conf.")
  693.  
  694. (defun conference (switches)
  695.   "Conference with other users."
  696.   (interactive "sArgs to conference (switches): ")
  697.  
  698.   (require 'shell)
  699.  
  700.   (let ((buffer (get-buffer-create "*conference*")))
  701.     (switch-to-buffer buffer)
  702.  
  703.     (if (get-buffer-process buffer)
  704.     (error "A conference process is already running"))
  705.  
  706.     (setq conf-process
  707.       (start-process "conf" buffer
  708.              "/bin/sh" "-c" (format "conf %s" switches))))
  709.  
  710.   (shell-mode)
  711.   (turn-on-auto-fill)
  712.   (setq mode-name "Conference")
  713.   (set-marker (process-mark conf-process) (point-max))
  714.   (set-process-filter conf-process 'conf-filter))
  715.  
  716. (defun conf-filter (process string)
  717.   (save-excursion
  718.     (set-buffer (process-buffer process))
  719.     (goto-char (process-mark process))
  720.     (let ((start-line (point)))
  721.       (insert-before-markers string)
  722.       ;;    (fill-region start-line (point))
  723.       )
  724.  
  725.     (if (get-buffer-window (process-buffer process))
  726.     nil
  727.       (beep t))))
  728. SHAR_EOF
  729. fi # end of overwriting check
  730. #    End of shell archive
  731. exit 0
  732. -- 
  733.   "If green is all there is to be, then green is good enough for me" - ktf
  734. [  Keith   ]  UUCP: {ucsd, cbosgd!crash, sdcsvax!crash, nosc!crash}!elgar!ag
  735. [Gabryelski]  INET: ag@elgar.cts.com                 ARPA: elgar!ag@ucsd.edu
  736.  
  737.